<template>
  <div class="app-container">
    <el-row :gutter="10" style="margin-bottom: 20px;">
      <el-col :span="1.5">
        <el-row>
          <el-col :span="24">
            <el-page-header @back="backTo" title="" :content="machineIp"/>
          </el-col>
        </el-row>
      </el-col>
      <el-col :span="1.5" style="float: right;">
        <el-button style="margin-left: 20px;"
                   type="primary"
                   icon="el-icon-edit"
                   size="mini"
        >编辑</el-button>
      </el-col>
      <el-col :span="1.5" style="float: right;">
        <el-button style="margin-left: 20px;"
                   type="primary"
                   plain
                   icon="el-icon-download"
                   size="mini"
        >下载日志</el-button>
      </el-col>
      <el-col :span="1.5" style="float: right;">
        <el-button style="margin-left: 20px;"
                   type="danger"
                   plain
                   icon="el-icon-refresh-right"
                   size="mini"
        >重启Jwagent</el-button>
      </el-col>
    </el-row>

    <el-tabs v-model="activeTab">
      <el-tab-pane label="基本信息" name="basic" lazy>
        <machine-basic :machine-id="machineId"/>
      </el-tab-pane>
      <el-tab-pane label="JwAgent" name="jwagent" lazy>
        <machine-agent :machine-id="machineId"/>
      </el-tab-pane>
      <el-tab-pane label="监控" name="monitor" lazy>
        <machine-monitor :machine-ip="machineIp" v-if="activeTab==='monitor'"/>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import MachineBasic from "@/views/machine/machineBasic";
import MachineAgent from "@/views/machine/machineAgent";
import MachineMonitor from "@/views/machine/machineMonitor";
export default {
  name: "MachineDetail",
  components: {MachineBasic,MachineAgent,MachineMonitor},
  data() {
    return {
      machineId:this.$route.params.machineId,
      machineIp:this.$route.params.ip,
      activeTab:"basic",
    };
  },
  created() {
  },
  methods: {
    backTo(){
      this.$router.push("/machine");
    },
  }
};
</script>
